/**
 * 文件名：****.java
 * 版权：Copyright Lightkit All Rights Reserved.
 * 描述：*****
 */
package com.lightkits.wms.domain.saveonhand;

import com.lightkits.framework.soa.hzero.executor.ServiceExecutor;
import com.lightkits.wms.domain.saveonhand.service.QueryInventoryOnhandDomain;
import com.lightkits.wms.dto.onhand.QueryInventoryOnhandRequestType;
import com.lightkits.wms.dto.onhand.QueryInventoryOnhandResponseType;
import com.lightkits.wms.dto.onhand.model.BdOnhandQuantityDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * QueryInventoryOnhandExecutor
 *
 * @author menxiao.wu@hand-china.com
 * Created on 2019-02-27 13:50
 */
@Component
public class QueryInventoryOnhandExecutor implements
        ServiceExecutor<QueryInventoryOnhandRequestType, QueryInventoryOnhandResponseType> {
    private QueryInventoryOnhandDomain service;

    @Autowired
    public QueryInventoryOnhandExecutor(QueryInventoryOnhandDomain service) {
        this.service = service;
    }

    @Override
    public QueryInventoryOnhandResponseType service(QueryInventoryOnhandRequestType request) {
        QueryInventoryOnhandResponseType response = new QueryInventoryOnhandResponseType();
        response.setSuccessful(true);
        List<String> organizationIdList = request.getOrganizationIdList();
        List<String> itemIdList = request.getItemIdList();
        List<String> uomList = request.getUomList();
        List<String> primaryUomList = request.getPrimaryUomList();
        List<String> lotNumberList = request.getLotNumberList();
        List<String> warehouseIdList = request.getWarehouseIdList();
        List<String> wmAreaIdList = request.getWmAreaIdList();
        List<String> storageUnitCodeList = request.getStorageUnitCodeList();
        List<String> ownerTypeList = request.getOwnerTypeList();
        List<String> ownerIdList = request.getOwnerIdList();
        List<String> featureTypeList = request.getFeatureTypeList();
        List<String> featureValueList = request.getFeatureValueList();
        Boolean mergeFlag = request.getMergeFlag();
        List<BdOnhandQuantityDTO> bdOnhandQuantityDTOS = service.queryInventoryOnhand(
                organizationIdList, itemIdList, uomList, primaryUomList,
                lotNumberList, warehouseIdList, wmAreaIdList, storageUnitCodeList, ownerTypeList,
                ownerIdList, featureTypeList, featureValueList, mergeFlag);
        response.setBdOnhandQuantityDTOS(bdOnhandQuantityDTOS);
        return response;
    }
}
